package com.zzzzzz.core.web;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class GlobalController extends BaseController {

	/**
	 * Handles requests for the application home page.
	 * @throws Exception 
	 */

//	@RequestMapping(value = "/error", method = RequestMethod.GET)
//	public String error() {
//		return "error";
//	}

	@RequestMapping(value="/unauthorized", method=RequestMethod.GET)
	public String unauthorized(Model model, HttpServletRequest request) {
		if(isSignedIn()) {
	        return "redirect:/home";
		}else {
	        return "redirect:/login";
		}
	}

	@RequestMapping(value = "/help", method = RequestMethod.GET)
	public String viewHelpPage(Model model) {
		return "help";
	}
	
	@RequestMapping(value = "/feedback", method = RequestMethod.GET)
	public String viewFeedbackPage(Model model) {
		return "feedback";
	}
	
}
